package net.lab1024.sa.admin.module.basedata.customer.constant;

/**
 * 客户相关
 */
public interface CusConstant {

    interface Customer {

        /**
         * 客户类型
         */
        enum CustomerType {

            PERSONAL("个人"),
            COMPANY("公司");

            private String name;


            CustomerType(String name) {
                this.name = name;
            }

            public static CustomerType getStatus(String state) {
                for (CustomerType orderState : CustomerType.values()) {
                    if (orderState.name.equals(state)) {
                        return orderState;
                    }
                }
                return null;
            }
        }

        /**
         * 单据状态
         */
        enum ApproveStatus {

            UNSUBMIT("未提交"),
            SUBMIT("已提交"),
            APPROVE("已审批"),
            REJECT("已驳回");

            private String name;

            ApproveStatus(String name) {
                this.name = name;
            }

            public static ApproveStatus getStatus(String state) {
                for (ApproveStatus status : ApproveStatus.values()) {
                    if (status.name.equals(state)) {
                        return status;
                    }
                }
                return null;
            }
        }
    }

    interface CustomerLicense {
        enum CompanyType {
            LIMITED_COMPANY("有限责任公司"),
            SHAREHOLDING_LIMITED_COMPANY("股份有限责任公司"),
            SOLE_PROPRIETORSHIP("个人独资企业"),
            PARTNERSHIP("合伙企业");

            private final String description;

            // 枚举构造函数
            CompanyType(String description) {
                this.description = description;
            }

            // 根据描述获取枚举值
            public static CompanyType fromDescription(String description) {
                for (CompanyType type : CompanyType.values()) {
                    if (type.description.equals(description)) {
                        return type;
                    }
                }
                return null;
            }

        }

    }

}
